package com.game.service.beans.game;

import com.game.service.beans.UserInfo;
import com.game.service.beans.livepk.CreateLivePK;

public class TableInfo {
    private String tableId;
    private int tableStatus;//桌子状态 //0新创建,1两名玩家进入,2,销毁
    private int createTime;//创建时间
    private int matchDuration;//比赛时长,//默认为60秒,后期可以由创建者设置。
    private long matchStartTime;//比赛开始时间

    private int winner;//胜利,1表示房主(左边)胜利,2.表示右边胜利
    private int onDestroyUid;//被谁销毁的
    private int onDestroyTime;//玩家不准备系统会销毁房间，避免占用,默认为30秒
    private UserInfo playerInfoA;
    private UserInfo playerInfoB;

    private TableConfig config;
    private CreateLivePK livePK;

    public String getTableId() {
        return tableId;
    }

    public void setTableId(String tableId) {
        this.tableId = tableId;
    }

    public int getTableStatus() {
        return tableStatus;
    }

    public void setTableStatus(int tableStatus) {
        this.tableStatus = tableStatus;
    }


    public UserInfo getPlayerInfoA() {
        return playerInfoA;
    }

    public void setPlayerInfoA(UserInfo playerInfoA) {
        this.playerInfoA = playerInfoA;
    }

    public UserInfo getPlayerInfoB() {
        return playerInfoB;
    }

    public void setPlayerInfoB(UserInfo playerInfoB) {
        this.playerInfoB = playerInfoB;
    }


    public int getWinner() {
        return winner;
    }

    public void setWinner(int winner) {
        this.winner = winner;
    }

    public int getCreateTime() {
        return createTime;
    }

    public void setCreateTime(int createTime) {
        this.createTime = createTime;
    }

    public void setCreateTimeAdd() {
        this.createTime += 1;
    }


    public int getMatchDuration() {
        return matchDuration;
    }

    public void setMatchDuration(int matchDuration) {
        this.matchDuration = matchDuration;
    }

    public void setMatchDurationLower() {
        this.matchDuration -= 1;
    }

    public int getOnDestroyUid() {
        return onDestroyUid;
    }

    public void setOnDestroyUid(int onDestroyUid) {
        this.onDestroyUid = onDestroyUid;
    }

    public int getOnDestroyTime() {
        return onDestroyTime;
    }

    public void setOnDestroyTime(int onDestroyTime) {
        this.onDestroyTime = onDestroyTime;
    }

    public void setOnDestroyTimeLower() {
        this.onDestroyTime -= 1;
    }

    public long getMatchStartTime() {
        return matchStartTime;
    }

    public void setMatchStartTime(long matchStartTime) {
        this.matchStartTime = matchStartTime;
    }

    public TableConfig getConfig() {
        return config;
    }

    public void setConfig(TableConfig config) {
        this.config = config;
    }

    public CreateLivePK getLivePK() {
        return livePK;
    }

    public void setLivePK(CreateLivePK livePK) {
        this.livePK = livePK;
    }

    @Override
    public String toString() {
        return "TableInfo{" +
                "tableId=" + tableId +
                ", tableStatus=" + tableStatus +
                ", createTime=" + createTime +
                ", matchDuration=" + matchDuration +
                ", matchStartTime=" + matchStartTime +
                ", winner=" + winner +
                ", onDestroyUid=" + onDestroyUid +
                ", onDestroyTime=" + onDestroyTime +
                ", playerInfoA=" + playerInfoA +
                ", playerInfoB=" + playerInfoB +
                ", config=" + config +
                ", livePK=" + livePK +
                '}';
    }

    public enum TableState {
        ACreate, BJoin, Destroy

    }

    public enum Identity {
        Default, Left, Right

    }

    public final static String TABLE_DEFAULT_ID = "";
}
